<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>双面翻转</title>
    
    <style>
        body {
            perspective: 400px;
        }

        .box {
            position: relative;
            width:400px;
            height: 125px;
            margin: 10px auto;
            transition: all 1s;  /* 动画持续时间 */
            transform-style: preserve-3d; /* 动画保留立体空间 */
        }

        /* 鼠标触发动画 */
        .box:hover {
            transform: rotateY(180deg);
        }
        .front, .back {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;

            /* 文字处理 */
            color: #000000;
            text-align: center;
            line-height: 300px;
        }
        div {
          
            color: #000;
            text-align: center;
            line-height: 300px;
        }
        div img {
            position: absolute;
            top: 0;
            left: 13.5%;
            width: 73%;
        }
        .front {
            z-index: 0;
        }
        .back {
            transform: rotateY(180deg); /* 靠背旋转 */
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="front">喜欢我的人<img src="./mag/2.jpg" alt=""></div>
        <div class="back">我喜欢的人<img src="./mag/1.jpg" alt=""></div>
 
    </div>
    
</body>

</html>